(function(cjs,an){
    let p;
    /**
     * 进度条
     */
    let ProgressBar=function(){
        this.Container_constructor();
        //当前进度,用0到1表示
        let _progress=0.5;
        let _w=500;

        let bg=new cjs.Shape();
        bg.y=20;
        this.addChild(bg);

        let slider=new cjs.Shape();
        slider.y=20;
        this.addChild(slider);

        let txt=new cjs.Text("loading... 100%", "20px Arial", "#ffffff");
        txt.parent=this;
        this.addChild(txt);

        this.setProgress=function(value){
            _progress=value;
            txt.text='loading... '+(value*100).toFixed(0)+'%';
            draw();
        };
        //set/get
        Object.defineProperties(this, {
            width: { set:function(value){
                _w=value;
                draw();
            }, get: function(){return _w} },
            height: { set: function(value){}, get: function(){return this.getBounds().height} }
        });
        
        function draw(){
            txt.x=(_w-txt.getBounds().width)/2;

            bg.graphics.clear();
            bg.graphics.beginFill('#ffffff');
            bg.graphics.rr(0,0,_w,12,6);
            bg.graphics.endFill();

            slider.graphics.clear();
            if(_progress<=0){
                slider.graphics.beginFill('black');
            }else if(_progress>0&&_progress<1){
                slider.graphics.beginLinearGradientFill(['#ffffff','#ffffff','#000000','#000000'],[0,_progress,_progress,1],1,0,498,0);
            }else{
                slider.graphics.beginFill('white');
            }
            slider.graphics.rr(1,1,498,10,5);
            slider.graphics.endFill();
        }
        draw();
    };
    p = cjs.extend(ProgressBar, cjs.Container);
    ProgressBar=cjs.promote(ProgressBar,'Container');

    const UIComponent={};
    UIComponent.ProgressBar=ProgressBar;
    an.UIComponent=UIComponent;
})(createjs = createjs||{}, AdobeAn = AdobeAn||{});
var createjs, AdobeAn;